package Boundary;

import javax.swing.JOptionPane;

import Auxiliary.Sequence_Type;
import DataView.CDElementInfo;
import DataView.Sequence_Error;
import Executor.Main;
import Interfaces.ShowClassDiagram;
import Store.CDElement;
import Store.Class;
import Store.Element;
import Visualization.ClassDiagramVis;

public class UpdateInputCD extends BaseBoundary {
	public ClassDiagramVis currentInputCD;
	public Sequence_Type availableTypes;
	public ShowClassDiagram interfaccia = new ShowClassDiagram(this);
	public Main main;

	public UpdateInputCD(Main main) 
	{
		this.main=main;
	}

	public void mkUpdateInputCD(ClassDiagramVis CDVis, Sequence_Type avTypes) 
	{
		currentInputCD=CDVis;
		availableTypes=avTypes;
		main.updateProject.home.display(interfaccia.showClassDiagram(), false);
	}

	public void setInputCD(ClassDiagramVis CDVis, Sequence_Type avTypes) 
	{
		currentInputCD=CDVis;
		availableTypes=avTypes;
		interfaccia.showCD();
	}

	public void correct(Sequence_Error aErrs) {
		JOptionPane.showMessageDialog(interfaccia.container, aErrs.getDescription(), "Error", JOptionPane.WARNING_MESSAGE);
	}

	public void addCDElement(CDElementInfo aEl) 
	{
		main.doAddCDElement(aEl);
	}

	public void deleteCDElement(CDElement aEl) 
	{
		main.doDeleteCDElement(aEl);
	}

	public void updCDElement(CDElement aEl, CDElementInfo aNewElIN) 
	{
		main.doUpdCDElement(aEl, aNewElIN);
	}

	public void setContextClass(Class cl) 
	{
		main.doSetContextClass(cl);
	}
	
	public void validate(Element aEl) 
	{
		main.doValidate(aEl);
	}
	
	public void close() 
	{
		main.doClose();
	}
}